<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.ort">
<head>
    <meta charset="UTF-8">
    <title></title>
    <script th:src="@{/layui/layui.js}" type="text/javascript"></script>
    <link th:href="@{/layui/css/layui.css}" rel="stylesheet" />
    <style>
    </style>
</head>

<body>
<div class="layui-panel" style="padding: 8px; height: 100%">
        <table id="regionTable"lay-filter="regionTable " class="layui-table layui-form"></table>
</div>

<script>
    layui.config({
        base:'/js/'
    })
    var $;
    layui.use(['form','layer','jquery','treeTable'],function(){
        var treeTable=layui.treeTable,form=layui.form,layer=layui.layer;

        $=layui.jquery;

        //加载表格

            treeTable.render({
                elem: '#regionTable',
                height: 'full',
                url: '/system/rc/find2',
                tree: {
                    iconIndex: 0,
                    isPidData: true,
                    idName: 'id',
                    pidName: 'pid',
                    openName: true
                },
                cols: [
                    [
                        {field: 'name', title: '区域名称'},
                        {field: 'type', title: '区域类型', templet: function (obj) {
                                if (obj.type == 1) {
                                    return "省";
                                } else if (obj.type == 2) {
                                    return "市";
                                } else {
                                    return "区/县"
                                }
                            }
                        },
                        {field: 'code', title: '区域编码'}

                    ]
                ]
            })
    })
</script>
</body>
</html>
